<template>
      <form class="info" autocomplete="off">
      姓名：<input type="text" class="uname" name="uname" v-model="studentList.name" /> 
      年龄：<input
        type="text"
        class="age"
        name="age"
        v-model="studentList.age"
      />
      性别:
      <select name="gender" class="gender" v-model="studentList.gender">
        <option value="男">男</option>
        <option value="女">女</option>
      </select>
      薪资：<input type="text" class="salary" name="salary" v-model="studentList.salary" /> 
      就业城市：<select
        name="city"
        class="city"
        v-model="studentList.city"
      >
        <option value="北京">北京</option>
        <option value="上海">上海</option>
        <option value="广州">广州</option>
        <option value="深圳">深圳</option>
        <option value="曹县">曹县</option>
      </select>
      <button class="add" @click.prevent="add">录入</button>
    </form>
</template>

<script>

export default {
   props : {
      studentLists : {
         type : Array,
         required : true
      }
   },
   data(){
      return {
         studentList : {
            name : '',
            age : '',
            gender : '男',
            salary : '',
            city : '北京'
         },
         // arr : []
         lists : []
      }
   },
   methods : {
      add() {
         if (this.studentList.name === '' || this.studentList.age === '' || this.studentList.salary === '') {
            return alert('输入内容不能为空')
         }
         this.studentLists.push({
            ...this.studentList
         })
         this.studentList.name = this.studentList.age = this.studentList.salary = ''
         this.studentList.gender = '男'
         this.studentList.city = '北京'
      }
   }
}
</script>

<style>

</style>